import * as dictServices from '../../services/design/dictServices';
import { notification } from 'antd';
export default {
    namespace: 'dict',
    state: {
        dictlist:[],
        structureTree:[]
    },
    reducers: {
        setDictList(state, { payload: dictlist }) {
            return { ...state, dictlist};
        },
        setStructureTree(state, { payload: structureTree }) {
            return { ...state, structureTree};
        }
    },
    effects: {
        *getDictList({ payload:  params  }, { call, put }) {
            /********获取所有项目***********/
            const res = yield call(dictServices.getDictList, { ...params });
            
            if (res&&res.data && res.data.code == "200") {
                yield put({
                    type: 'setDictList',
                    payload: res.data.data&&res.data.data.rows?res.data.data.rows.filter(item=>item.status==58).sort((a,b)=>a.dictSort-b.dictSort):[]
                });
            } else {
              
            }
        },
    }
}